<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>详情页</title>
    <link rel="stylesheet" href="/lib/layui-v2.6.8/css/layui.css" media="all">
    <style>
        .layui-fluid {
            margin-top: 30px;
        }
        .layui-row img {
            max-height: 300px;
        }
        table {
            border-top: 1px solid #ccc;
            border-left: 1px solid #ccc;
        }
        table td, table th {
            border-bottom: 1px solid #ccc;
            border-right: 1px solid #ccc;
            padding: 3px 5px;
        }
        table th {
            border-bottom: 2px solid #ccc;
            text-align: center;
        }
        blockquote {
            display: block;
            border-left: 8px solid #d0e5f2;
            padding: 5px 10px;
            margin: 10px 0;
            line-height: 1.4;
            font-size: 100%;
            background-color: #f1f1f1;
        }
        code {
            display: inline-block;
            *display: inline;
            *zoom: 1;
            background-color: #f1f1f1;
            border-radius: 3px;
            padding: 3px 5px;
            margin: 0 3px;
        }
        pre code {
            display: block;
        }
        ul, ol {
            margin: 10px 0 10px 20px;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <div class="layui-col-md8 layui-col-md-offset2 layui-col-xs12">
            <h1>{{$baseItem->title}}{{if $pageCount > 1}} ({{$page}} / {{$pageCount}}){{/if}}</h1>
            <blockquote class="layui-elem-quote layui-quote-nm">
                <i class="layui-icon layui-icon-home"></i>
                <a href="/index.html">首页</a>
                <i class="layui-icon layui-icon-more-vertical"></i>
                <a target="_blank" href="/index.html?id={{$baseItem->menu_id}}">{{$baseItem->menu_name}}</a>
                {{if $baseItem->title_short}}
                    <i class="layui-icon layui-icon-rss"></i>
                    {{$baseItem->title_short}}
                {{/if}}
                {{if $baseItem->tag_names}}
                    <i class="layui-icon layui-icon-note"></i> {{$baseItem->tag_names}}
                {{/if}}
                <i class="layui-icon layui-icon-date"></i> {{$baseItem->created_at}}
                <i class="layui-icon layui-icon-read"></i> {{$baseItem->viewed_count}}
                <i class="layui-icon layui-icon-praise"></i> {{$baseItem->liked_count}}
                <br />
                <i class="layui-icon layui-icon-about"></i>
                {{if $baseItem->source_from}}
                    转自：{{$baseItem->source_from}} (若存在侵权，请及时联系处理。)
                {{else}}
                    原创内容，转载请注明出自于本站，谢谢。
                {{/if}}
                <br />
                {{if $detailItem->content_short}}
                    <i class="layui-icon layui-icon-dialogue"></i> {{$detailItem->content_short}} ...
                {{/if}}
            </blockquote>
            {{if $detailItem->image_inner}}
                {{if $detailItem->image_link}}<a target="_blank" href="{{$detailItem->image_link}}">{{/if}}
                <img src="{{$detailItem->image_inner}}" alt="" title="配图可能与内容无关，图片若有侵权，请及时联系处理。" />
                {{if $detailItem->image_link}}</a>{{/if}}
                <br /><br />
            {{/if}}
            <div id="id_div_content">{{if $detailItem->content_ide == 0}}{{echo nl2br($detailItem->content);}}{{else}}{{$detailItem->content}}{{/if}}</div>
            <br />
            <hr class="layui-bg-gray">
            <div id="id_div_pager"></div>
        </div>
    </div>
</div>
<!--[if lt IE 9]>
<script src="//cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="//cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="/lib/layui-v2.6.8/layui.js"></script>
{{if $detailItem->content_ide == 2}}
    <script src="/lib/marked/marked.min.js" charset="utf-8"></script>
    <script src="/js/lay-config.js?v=2.0.0" charset="utf-8"></script>
{{/if}}
<script>
    layui.use(['util', 'layer'], function () {
        let util = layui.util,
            layer = layui.layer,
            $ = layui.jquery;

        $.post('/detail/count.api', {
            'id': {{$id}},
            'type': 'view'
        }, function (re) {
            return;
        }, 'json');

        util.fixbar({
            bar1: '<i class="layui-icon layui-icon-praise" style="font-size: 30px" id="id_i_like"></i>',
            top: true,
            css: {right: 50, bottom: 100},
            bgcolor: '#999',
            click: function (type) {
                if (type === 'bar1') {
                    $.post('/detail/count.api', {
                        'id': {{$id}},
                        'type': 'like'
                    }, function (re) {
                        if (re.code == 0) {
                            layer.tips('谢谢您的赞。', '#id_i_like');
                        } else {
                            layer.tips(re.msg, '#id_i_like');
                        }
                    });
                }
            }
        });

    });

    {{if $detailItem->content_ide == 2}}
    layui.use('easyeditor', function (easyEditor) {
        easyEditor.render({
            elem: '#id_div_content'
        });
    });
    {{/if}}

    {{if $pageCount > 1}}
    layui.use('laypage', function (laypage) {
        laypage.render({
            elem: 'id_div_pager',
            count: {{$pageCount}},
            limit: 1,
            curr: {{$page}},
            layout: ['prev', 'page', 'next'],
            theme: '#aaa',
            jump: function (obj, first) {
                if (!first) {
                    if (obj.curr == 1) {
                        window.location.href = '/detail/{{$id}}.html';
                    } else {
                        window.location.href = '/detail/{{$id}}-' + obj.curr + '.html';
                    }
                }
            }
        });
    });
    {{/if}}

</script>
</body>
</html>